package com.wan.net.core.tcp;

import com.wan.net.config.HostAndPort;
import com.wan.net.core.AbstractServer;
import com.wan.net.core.ServerType;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;

import javax.annotation.Nullable;
/**
 * @author wwh
 * @date 2022/6/16 14:57
 */
public class TcpServer extends AbstractServer {

    public TcpServer(HostAndPort hostAndPort) {
        super(hostAndPort);
    }

    public TcpServer(HostAndPort hostAndPort, int idleTimeout) {
        super(hostAndPort, idleTimeout);
    }

    public TcpServer(HostAndPort hostAndPort, @Nullable ChannelHandler channelHandler) {
        super(hostAndPort, channelHandler);
    }

    public TcpServer(HostAndPort hostAndPort, int idleTimeout, @Nullable ChannelHandler channelHandler) {
        super(hostAndPort, idleTimeout, channelHandler);
    }

    @Override
    protected void channelChannelInitializer(ChannelPipeline pipeline) {
        pipeline.addLast(new TcpCodec());
    }

    @Override
    public ServerType getServerType() {
        return ServerType.TCP;
    }


}
